angular.module('starter.controllers', [])

.controller('DashCtrl', function($scope) {})

.controller('ChatsCtrl', function($scope, Chats) {
  // With the new view caching in Ionic, Controllers are only called
  // when they are recreated or on app start, instead of every page change.
  // To listen for when this page is active (for example, to refresh data),
  // listen for the $ionicView.enter event:
  //
  //$scope.$on('$ionicView.enter', function(e) {
  //});

  $scope.chats = Chats.all();
  $scope.remove = function(chat) {
    Chats.remove(chat);
  };
})

.controller('ChatDetailCtrl', function($scope, $stateParams, $ionicLoading,$http) {
  //$scope.chat = Chats.get($stateParams.chatId);
  //console.log($stateParams.chatId);

  $scope.show = function() {
    $ionicLoading.show({
      template: '正在连接...'
    });
  };
  $scope.hide = function() {
    $ionicLoading.hide();
  };

  //$scope.show();

  //hub = $.connection.ctripHub;

  $scope.cardList = [[{
    icon:'https://avatars3.githubusercontent.com/u/11214?v=3&s=460',
    title:'酒店大优惠',
    desc:'大奖等你来',
    url:''
  },{
    icon:'https://avatars3.githubusercontent.com/u/11214?v=3&s=460',
    title:'酒店大优惠',
    desc:'大奖等你来',
    url:''
  }],[{
    icon:'https://avatars3.githubusercontent.com/u/11214?v=3&s=460',
    title:'酒店大优惠',
    desc:'大奖等你来',
    url:''
  },{
    icon:'https://avatars3.githubusercontent.com/u/11214?v=3&s=460',
    title:'酒店大优惠',
    desc:'大奖等你来',
    url:''
  }]];
  $http.get('')
    .success(function(data,status){

    })
    .error(function(data,status){

    })

})

.controller('AccountCtrl', function($scope) {
  $scope.settings = {
    enableFriends: true
  };
});